<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProductsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('products', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('code', 20)->comment('产品代码');
            $table->unsignedBigInteger('customer_id')->comment('客户ID');
            $table->string('title', 255)->comment('产品标题');
            $table->double('gross_weight')->comment("毛重");
            $table->string('brand', 50)->comment("品牌");
            $table->tinyInteger('status')->default(0)->comment('状态: 0 草稿; 1 审核; 2 审核失败; 3 正常; 4 出货锁定;');
            $table->timestamps();
            $table->unique(['code', 'customer_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('products');
    }
}
